package binarytree;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * 测试二叉树
 */
@SuppressWarnings({"all"})
public class Test {

    public static void main(String[] args) {
        BinaryTree bt = new BinaryTree();
        BinaryTree.TreeNode treeRoot = bt.createTree(); // 创建一颗二叉树
        System.out.print("前序遍历: ");
        bt.preOrder(treeRoot);
        System.out.print("\n中序遍历: ");
        bt.inOrder(treeRoot);
        System.out.print("\n后序遍历: ");
        bt.postOrder(treeRoot);
        bt.size(treeRoot);
        System.out.print("\n节点数量-遍历方式: " + bt.nodeSize);
        System.out.print("\n节点数量-子问题方式: " + bt.size2(treeRoot));
        bt.getLeafNodeCount1(treeRoot);
        System.out.print("\n叶子节点数量-遍历方式: " + bt.leafSize);
        System.out.print("\n叶子节点数量-子问题方式: " + bt.getLeafNodeCount2(treeRoot));
        System.out.print("\n第1层节点数: " + bt.getKLevelNodeCount(treeRoot, 1));
        System.out.print("\n第2层节点数: " + bt.getKLevelNodeCount(treeRoot, 2));
        System.out.print("\n第3层节点数: " + bt.getKLevelNodeCount(treeRoot, 3));
        System.out.print("\n第4层节点数: " + bt.getKLevelNodeCount(treeRoot, 4));
        System.out.println("\n高度为: " + bt.getHeight(treeRoot));
        System.out.println(bt.find(treeRoot, 'E'));
        System.out.println(bt.find(treeRoot, 'Z'));
        System.out.print("层次遍历为: ");
        bt.levelOrder(treeRoot);
    }
}
